<include file="Public/siteTopbar" />
<include file="Public/header" />


<div class="container logintop">
<h3>My Account</h3>
<p>My Account allows you to manage your setting and preferences. Existing wish list or project portfolio logins can be used to login to My Account.</p>
</div>


<div class="container usercenter">
    <div class="col-sm-6">
        <div class="longinBox">
            <h3>- Forgot Your Password? -</h3>
            <form id="forget_pwd" action="{:U('User/identity')}" method="post">
                <ul class="form-list">

                    <li>
                         <label for="email" class="required"><em>*</em>Email Address:</label>
                         <input type="text" id="username" name="username"  value="" class="loginInput required-entry validate-email" title="Email Address">
                                    <input type="hidden" name="type" value="forget">
                        <span class="v-tips verify-tips" data-tips-for="username"></span>

                    </li>
                    <!--<li style="position:relative;"><label for="email" class="required"><em>*</em>Code:</label><input class="loginInput required-entry validate-email" onKeyDown="if(event.keyCode==13){checkSubmit();}" type="text" name="verify_code" id="captcha"/>-->
                        <!--<span class="v-tips verify-tips" data-tips-for="captcha"><i class="icon"></i></span>-->
                    <!--</li>-->

                     <!--<img id="verify_code_img"  src="/index.php?m=Home&c=User&a=verify&type=forget"  onclick="verify()"/>-->

                    <li>
                        <button type="button" class="loginbutton"   onClick="chkuser()"  ><span><span>Submit</span></span></button>
                    </li>
                </ul>
            </form>
        </div>
    </div>
    
    
	<include file="forpass_public" />

</div>


<include file="Public/footer" />

<script>
	function verify(){
		$('#verify_code_img').attr('src','/index.php?m=Home&c=User&a=verify&r='+Math.random());
	}

	var uflag = false;
	var cflag = false;

	function chkuser(){
		$('span[data-tips-for="username"]').find('.txt').empty();
		var username = $('#username').val();
		if(username == ''){
			//show_error('username','用户名不能为空');
			layer.msg('Email Address is a required field.', {
                            icon: 1,  
                            time: 2000 
                        });
						
			return false;
		}else{
			$.ajax({
				url:'/index.php?m=Home&c=User&a=check_username&t='+Math.random(),
				type:'post',
				dataType:'json',
				data:{username:username},
				success:function(t){
					if(t==1){
						$('span[data-tips-for="username"]').css('display','inline');
						$('span[data-tips-for="username"]').find('i').removeClass('icon');
						$('span[data-tips-for="username"]').find('i').removeClass('icon-warn');
						$('span[data-tips-for="username"]').find('i').addClass('icon-loss');
						$('span[data-tips-for="username"]').find('.txt').empty();
						uflag = true;
                        $('#forget_pwd').submit();
					}else{
						layer.msg('Email Address error.', {
                            icon: 1,  
                            time: 2000 
                        });
						//$.artTip('Email Address error.', 800);
					}
				}
			})
		}
	}

//	function chkcaptcha() {
//
//        $('span[data-tips-for="captcha"]').find('.txt').empty();
//
//		var captcha = $('#captcha').val();
//		if(captcha == ''){
//			layer.msg('verification code must be filled.', {
//                            icon: 1,
//                            time: 2000
//                        });
//			return false;
//		}else if(captcha.length!=4){
//
//			layer.msg('Verification code error.', {
//                            icon: 1,
//                            time: 2000
//                        });
//			return false;
//		}else{
//			$.ajax({
//				url:'/index.php?m=Home&c=User&a=check_captcha&t='+Math.random(),
//				type:'post',
//				dataType:'json',
//				data:{verify_code:captcha},
//				success:function(t){
//
//					if(t==1){
//						$('span[data-tips-for="captcha"]').css('display','inline');
//						$('span[data-tips-for="captcha"]').find('i').removeClass('icon');
//						$('span[data-tips-for="captcha"]').find('i').removeClass('icon-warn');
//						$('span[data-tips-for="captcha"]').find('i').addClass('icon-loss');
//						$('span[data-tips-for="captcha"]').find('.txt').empty();
//						cflag = true;
//						gonext();
//					}else{
//						layer.msg('Incorrect verification code.', {
//                            icon: 1,
//                            time: 2000
//                        });
//						return false;
//					}
//				}
//			})
//    }
//	}

	function gonext(){
		if($('#username').val() == ''){
			$.artTip('用户名不能为空.', 800);
			return;
		}
		if($('#captcha').val() == ''){
			$.artTip('验证码不能为空.', 800);
			return;
		}
		if(!uflag){
			$.artTip('用户名验证有误.', 800);
			return;
		}else if(!cflag){
			$.artTip('图形验证码有误.', 800);
			return;
		}
		if(uflag && cflag){
			$('#forget_pwd').submit();
		}
	}

	function show_error(type,msg){
		$('span[data-tips-for="'+type+'"]').css('display','inline');
		$('span[data-tips-for="'+type+'"]').find('i').removeClass('icon');
		$('span[data-tips-for="'+type+'"]').find('i').removeClass('icon-loss');
		$('span[data-tips-for="'+type+'"]').find('i').addClass('icon-warn');
		$('span[data-tips-for="'+type+'"]').find('.txt').empty().html(msg);
	}
</script>
</div>
</body>
</html>